package com.example.administrator.x3picturetransliteration.Util;

import android.content.Context;
import android.graphics.Color;

import com.zyao89.view.zloading.ZLoadingDialog;

import static com.zyao89.view.zloading.Z_TYPE.SINGLE_CIRCLE;

public class Loading2DialogUtil {

    private static Loading2DialogUtil sWaitingDialog;

    private ZLoadingDialog mZLoadingDialog2;

    private Loading2DialogUtil(Context context){

        mZLoadingDialog2 = new ZLoadingDialog(context);
        mZLoadingDialog2.setLoadingBuilder(SINGLE_CIRCLE)
                .setCanceledOnTouchOutside(false)
                .setCancelable(false)
                .setLoadingColor(Color.GRAY)
                .setHintText("等待中...");
    }

    public static Loading2DialogUtil getInstance(Context context){
        if (sWaitingDialog == null) {
            sWaitingDialog = new Loading2DialogUtil(context);
        }
        return sWaitingDialog;
    }

    public void show2(){
        mZLoadingDialog2.show();
    }

    public void dismiss2(){
        mZLoadingDialog2.dismiss();
        sWaitingDialog = null;
    }
}
